<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <!-- 加载Vue框架的库文件 -->
    <script src="js/vue.js"></script>
    <!-- 加载Axios框架的库文件 -->
    <script src="js/axios.js"></script>
    <!-- 加载jQuery的库文件 -->
    <script src="js/jquery-3.6.0.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <!-- 导入外部css文件 -->
    <link rel="stylesheet" href="css/login.css">
</head>
<body id="login">
    <div>
        <span id="logo">禧创OCP运营平台</span>
    </div>
   <div id="app">
    <div>
        <el-input id="operateName" size="" prefix-icon="el-icon-user-solid" v-model="operateName" placeholder="请输入账号" ></el-input>
        <br><div class="tip">{{tip1}}</div><br><!--提示信息1-->
        <el-input id="opPassword" prefix-icon="el-icon-lock" placeholder="请输入密码" v-model="opPassword" show-password></el-input>
        <br><div class="tip">{{tip2}}</div><br><!--提示信息2-->
        <el-button id="denglu" v-on:click="submit">登录</el-button>
    </div>
   </div>
</body>
<script type="module" >
    new Vue({
        el:"#app",
        data(){
            return{
                operateName:"",
                opPassword:"",
                tip1:"",
                tip2:"",
                sign:1,
                result:{
                   code:"",
                    msg:"",
                    data:{},
                }
            };
        },
        methods:{
            submit() {
                console.log(this.opPassword);
                console.log(this.operateName);
                let url="http://localhost:8088/loginY?"+"operateName="+this.operateName+"&opPassword="+this.opPassword;
                axios.post(url)
                    .then(result=>{
                        console.log(result);
                        if(result.data.flag){
                            alert("登陆成功！")
                            location.assign("http://localhost:8088/homepageY");
                        }else {
                            alert("登录失败，请检查用户名和密码是否输入正确");
                        }
                    })
            }
        },
    });

</script>
</html>
